The GetControlFromTable statement provides a way to parse an HTML table and find a specific control to interact with. The statement searches a specific table cell for a control and returns the control. The GetControlFromTable statement can be used instead of a control name in statements, which allows QA Wizard Pro to dynamically locate the correct control during playback.
When you add a checkpoint, object action, or low-level action statement using the Add Statement dialog box, QA Wizard Pro automatically adds the GetControlFromTable statement based on the selected search criteria. You can also add this statement in Text View.
In the following example, the GetControlFromTable statement searches for an HTMLLink control in the second column and second row of the Admin table in the Users window.
Window("Users").HTMLTable("Admin").GetControlFromTable("HTMLLink", 2, 2)
Suppose this table cell includes more than one HTMLLink control. In this case, you can also use control properties and expected values to uniquely identify the control you want to find. In the following example, the same statement is used in addition to the Inner Text property and the Details property value. During playback, QA Wizard Pro only returns the control from the cell if the Inner Text property value is Details.
Window("Users").HTMLTable("Admin").GetControlFromTable("HTMLLink", 2, 2, "Inner Text", "Details")
If QA Wizard Pro cannot locate the control using the GetControlFromTable statement, playback stops and an error is displayed the Errors pane.
Note: Use multiple GetControlFromTable statements to locate controls in nested tables. See Testing nested HTML tables.